<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
	<link rel = "Shortcut Icon" href="http://www.kaishengit.com/favicon.ico" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<style type="text/css">
		.navbar {
			margin-bottom: 0px;
		}
		
		#content {
			height: 600px;
		}
		
		.fieldset {
			position: absolute;
			margin-left: 160px;
			margin-top: 100px;
		}
		
		#btn {
			margin-left: 230px;
		}
		
		#naperror,#ftl {
			background-color: #eee;
			text-align: center;
			color: red;
			font-size: 16px;
			margin-left: 100px;
		}
	</style>
</head>
<body>
	<div class="container">
		<div class="navbar">
			<div class="navbar-inner">
				<div class="container">
					<a href="index" class="brand"> 凯盛项目管理系统</a>
				</div>
			</div>
		</div>
		<div class="wall" id="content">
			<form action="login" class="form-horizontal" method="post"
				id="myform">
				<fieldset class="fieldset">
					<c:choose>
						<c:when test="${param.code == '10001' }">
							<div class="well" id="naperror">用户名或密码错误</div>
						</c:when>
						<c:when test="${param.code == '10002' }">
							<div class="well" id="ftl">请先登录</div>
						</c:when>
						<c:when test="${param.code == '10003' }">
							<div class="well" id="ftl">账户被冻结，不能登录</div>
						</c:when>
						<c:when test="${param.code == '10004' }">
							<div class="well" id="ftl">用户名密码不能为空</div>
						</c:when>
					</c:choose>
					
					<div class="control-group" id="namediv">
						<label for="username" class="control-label">用户名：</label>
						<div class="controls">
							<input type="text" id="username" name="username" /> <span
								class="help-inline" id="span1"></span>
						</div>
					</div>
					<div class="control-group" id="pwddiv">
						<label for="password" class="control-label">密码：</label>
						<div class="controls">
							<input type="password" id="password" name="password" /> <span
								class="help-inline" id="span2"></span>
						</div>
					</div>
					<button id="btn" class="btn btn-primary" type="button">登陆</button>
				</fieldset>
			</form>
		</div>
	</div>
	<script type="text/javascript">
        $(document).ready(function() {

            $("#username").focus(function() {
                $("#span1").html("");
                $("#namediv").removeClass("error");
            });
            $("#username").blur(function() {
                var name = $(this).val();
                if (name.trim() == "") {
                    $("#span1").html("请输入用户名");
                    $("#namediv").addClass("error");
                }
            });
            $("#password").focus(function() {
                $("#span2").html("");
                $("#pwddiv").removeClass("error");
            });
            $("#password").blur(function() {
                var pwd = $(this).val();
                if (pwd == "") {
                    $("#span2").html("请输入密码");
                    $("#pwddiv").addClass("error");
                }
            });
            $("#btn").click(function() {
                var name = $("#username").val();
                var pwd = $("#password").val();
                if (name.trim() == "") {
                    $("#span1").html("请输入用户名");
                    $("#namediv").addClass("error");
                }
                if (pwd == "") {
                    $("#span2").html("请输入密码");
                    $("#pwddiv").addClass("error");
                }
                if (name.trim() != "" && pwd != "") {
                    $("#myform").submit();
                }
            });
        });
    </script>
</body>
</html>